package collection;

import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;

import jdkDemo.Customer;

public class TestSet {
	public static void main(String[] args) {
		Set<String> set = new HashSet<String>();
		set.add("abc");
		set.add("xyz");
		set.add("abc");
		
		System.out.println(set.size());
		for(String s:set){
			System.out.println(s);
		}
		
		
		Set<String> set2 = new TreeSet<String>();//数据自动排序,set中对象实现了compareable接口
//		Set<Customer> set2 = new TreeSet<Customer>(new AgeCompartor());
		set2.add("abc");
		set2.add("xyz");
		set2.add("abc");
		
		System.out.println(set2.size());
		for(String s:set2){
			System.out.println(s);
		}
		
		
	}
	
	
}
